Skip to content

Search: migrate dashboard notices to @wordpress/ui Notice (depends on #48537)#48550

Open
CGastrell wants to merge 4 commits intotrunkfrom
chore/search-notice-action-wp-ui-link
Open

Search: migrate dashboard notices to @wordpress/ui Notice (depends on #48537)#48550
CGastrell wants to merge 4 commits intotrunkfrom
chore/search-notice-action-wp-ui-link

Conversation

@CGastrell
Copy link
Copy Markdown
Contributor

@CGastrell CGastrell commented May 6, 2026

Fixes #

Important

Depends on #48537. Do not merge until #48537 has landed.
This branch is based on trunk. PR #48537 contains an interim Gridicon → @wordpress/icons migration of notice-action.jsx. This PR deletes that file outright. If this PR merges first, #48537 will conflict (and the interim swap there becomes meaningless). Merging in the order #48537 → this keeps the history of the wider Gridicon-removal sweep clean.

Proposed changes

Migrate the search dashboard's notice surface from the local SimpleNotice + NoticeAction wrappers to Notice.* from @wordpress/ui.

wp-ui-notice-after
  • record-meter/notice-box.jsx — tier notices use Notice.Root + Notice.Title + Notice.Description + Notice.Actions / Notice.ActionLink openInNewTab for the "Learn more" link. The legacy jp-search-notice-box__important class is replaced with intent="error", letting wp-ui handle the color/state via WPDS tokens.
  • pages/sections/first-run-section.jsx — indexing notice converted to Notice.Root + Title + Description.
  • global-notices/index.jsx — snackbar notices use Notice.Root + Notice.Description + Notice.CloseIcon, with auto-dismiss preserved via a small useEffect timer (replaces SimpleNotice's built-in duration prop). The redux store still ships is-info / is-success / is-warning / is-error status strings; they're mapped to wp-ui intents at render.
  • global-notices/store/actions.js — drops vestigial defaults (isCompact, isPersistent, displayOnNextPage) that no consumer ever read.

Deletions

  • notice/index.jsx (SimpleNotice — 130 lines, class component)
  • notice/notice-action.jsx (NoticeAction)
  • notice/style.scss (~270 lines of legacy dops-notice styling)
  • notice/test/index.test.jsx (tested SimpleNotice's dops-notice__icon-wrapper class)
  • record-meter/notice-box.scss (selectors only matched legacy markup)
  • Dead dops-notice overrides from global-notices/style.scss (snackbar positioning kept)

Bonus

Removes one site of @automattic/jetpack-components Gridicon usage (the icon inside SimpleNotice) — helps the broader #48160 modernization sweep.

Net diff

13 files, +72 / −681 lines. Single commit.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

Verified locally on a dev site after seeding a fake plan info option to bypass paid-plan gating:

  1. Tier notice (record-meter/notice-box) — surface the close-to-limit notice (e.g. recordCount in 80-99% of tierMaximumRecords) on the Jetpack Search admin page. Confirm:
    • Rounded notice with soft blue tint, info icon top-left.
    • "Learn more ↗" link opens in a new tab and includes an aria-label="(opens in a new tab)" indicator.
    • For tier-1 (data invalid), the notice renders with red/error intent automatically.
  2. First-run notice (first-run-section) — visible on a freshly licensed/uninitialized search dashboard. Should render with the same visual treatment as the tier notice but no actions.
  3. Global notices (global-notices) — trigger an action that dispatches successNotice, errorNotice, or updatingNotice (e.g. toggle a setting on the search settings page). Confirm:
    • Snackbar appears bottom-right.
    • Auto-dismisses after duration ms (default 2 s, updatingNotice 30 s).
    • Manual close via the X button works.
  4. Confirm no console errors or unstyled flashes.

A before/after of the tier-3 close-to-limit notice has been captured locally; happy to attach to the PR if reviewers want a visual.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the chore/search-notice-action-wp-ui-link branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack chore/search-notice-action-wp-ui-link

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions Bot added the [Package] Search Contains core Search functionality for Jetpack and Search plugins label May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: June 2, 2026
    • Code freeze: June 1, 2026

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Search plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label May 6, 2026
@CGastrell CGastrell added [Status] In Progress and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels May 6, 2026
@jp-launch-control
Copy link
Copy Markdown

jp-launch-control Bot commented May 6, 2026

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/packages/search/src/dashboard/components/global-notices/index.jsx 11/15 (73.33%) 1.90% 2 ❤️‍🩹
projects/packages/search/src/dashboard/components/record-meter/notice-box.jsx 18/18 (100.00%) 0.00% 0 💚
projects/packages/search/src/dashboard/components/pages/sections/first-run-section.jsx 3/6 (50.00%) 16.67% -3 💚

Full summary · PHP report · JS report

@simison
Copy link
Copy Markdown
Member

simison commented May 6, 2026

Does it make sense to keep basic components in Search like notice, instead of just deleting the whole component and replacing with wp-ui Notice where needed?

@CGastrell CGastrell force-pushed the chore/search-notice-action-wp-ui-link branch from 53594a6 to b3c84b2 Compare May 6, 2026 13:47
@CGastrell CGastrell changed the title Search: migrate NoticeAction to @wordpress/ui Link (depends on #48537) Search: migrate dashboard notices to @wordpress/ui Notice (depends on #48537) May 6, 2026
Replace the local SimpleNotice + NoticeAction wrappers with Notice.* from
@wordpress/ui across the search dashboard:

- record-meter/notice-box: tier notices use Notice.Root/Title/Description
  + Notice.Actions/ActionLink (openInNewTab); the legacy
  jp-search-notice-box__important class becomes intent="error".
- pages/sections/first-run-section: indexing notice uses Notice.Root/Title/
  Description.
- global-notices: snackbar notices use Notice.Root + Notice.Description +
  Notice.CloseIcon, with auto-dismiss preserved via a useEffect timer.
  Status strings remain in the redux store; mapped to wp-ui intents at render.

Drops vestigial fields the redux notice creators never set anyway
(isCompact, isPersistent, displayOnNextPage, notice.button/href).

Deletes the SimpleNotice/NoticeAction sources, their stylesheets, and
notice-box.scss; strips the dead .dops-notice* overrides from
global-notices/style.scss while keeping the snackbar positioning rules.

Removes one site of @automattic/jetpack-components Gridicon usage
(SimpleNotice's icon-wrapper) — helps the broader modernization sweep.

Follow-up to simison review feedback on #48537.
@CGastrell CGastrell force-pushed the chore/search-notice-action-wp-ui-link branch from b3c84b2 to d5977be Compare May 8, 2026 14:21
`@wordpress/ui` Notice uses `@wordpress/a11y` to announce notice text
via `<div class="a11y-speak-region">` regions appended to
`document.body`. After this PR's migration, the notice copy is in the
DOM twice (in the rendered Notice and in the body-level a11y-speak
live region), so `screen.getByText` throws "Found multiple elements".

Capture the `container` from `render()` and use
`within( container ).getByText(...)` so queries only see the
rendered Notice and ignore the screen-reader announcement region
that lives outside the container.

Verified locally: all 5 tests in `notice-box.test.jsx` pass.
@CGastrell CGastrell self-assigned this May 8, 2026
@CGastrell CGastrell added [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. labels May 8, 2026
@CGastrell CGastrell force-pushed the chore/search-notice-action-wp-ui-link branch from ef2b4ab to e863dc2 Compare May 8, 2026 20:50
CGastrell and others added 2 commits May 8, 2026 18:25
…shboard build

The Notice migration introduced a transitive dep on `@wordpress/theme` via
`@wordpress/ui`. The dependency-extraction-webpack-plugin externalized it to
the `wp-theme` script handle, which is not reliably registered as a WP script
in plain admin contexts (e.g., Jurassic Ninja test sites). When `wp-theme` was
missing from `$wp_scripts->registered`, WordPress silently skipped printing
`jp-search-dashboard` -- no script tag, no inline initial state, blank page.

Bundle both `@wordpress/theme` and `@wordpress/private-apis` together so the
module-init `lock()` call lands on the same private-apis consent map. Same
fix as #48173 (Components Notice migration) and #48171 (Boost). The search
dashboard does not pull in `@wordpress/dataviews`, so this does not hit the
my-jetpack collision case described there.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The jetpack plugin's changelogger uses bugfix/enhancement/compat/major/other
taxonomy, not fixed/changed/added/removed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Search Contains core Search functionality for Jetpack and Search plugins [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Plugin] Search A plugin to add an instant search modal to your site to help visitors find content faster. [Status] In Progress [Tests] Includes Tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants